﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TSON.GeoCOM
{
    public enum BAP_MEASURE_PRG
    {
        BAP_NO_MEAS = 0, // no measurements, take last one

        BAP_NO_DIST = 1, // no dist. measurement, angles only

        BAP_DEF_DIST = 2, // default distance measurements, pre-defined using BAP_SetMeasPrg

        BAP_CLEAR_DIST = 5, // clear distances

        BAP_STOP_TRK = 6, // stop tracking
    };
    /// <summary>
    /// class unfinished
    /// </summary>
    public class BAP
    {        
        public static RC MeasDistanceAngle(TsSerialPort com, BAP_MEASURE_PRG distMode, ref string outString)
        {
            string responseString = com.getResponse(string.Format("\n%R1Q,17017:{0}\r\n",
                Convert.ToInt32(distMode).ToString()));
            responseString = responseString.Trim();
            //dHz[double], dV[double], dDist[double],DistMode[long]
            outString = Helpers.getInfoString(responseString);
            return Helpers.getRcCode(responseString);
        }
        public static RC SearchTarget(TsSerialPort com, bool bDummy)
        {
            string responseString = com.getResponse(string.Format("\n%R1Q,17020:{0}\r\n",
                Convert.ToInt32(bDummy).ToString()));
            responseString = responseString.Trim();
            return Helpers.getRcCode(responseString);
        }
        public static RC SearchTarget(TsSerialPort com)
        {
            string responseString = com.getResponse(string.Format("\n%R1Q,17020:0\r\n"));
            responseString = responseString.Trim();
            return Helpers.getRcCode(responseString);
        }
    }
}
